home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
coding
/
dsp
/
c5xug.exe
/
INTR.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-07-11
|
2KB
|
75 lines
;**************************************************************
;
; intr.asm
;
; staff
;
; 07-11-90
;
; (C) Texas Instruments Inc., 1992
;
; Refer to the file 'license.txt' included with this
; this package for usage and license information.
;
;**************************************************************
* Foreground Program
.mmregs
TEMP .set 63h ; Temporary storage.
X .set 64h
Y .set 65h
COEFF .set 66h
; .
; .
; .
LAR AR1,#X ; AR1 points to X values
LAR AR2,#COEFF ; AR2 points to coefficients b,a,c
* in that order
LAR AR3,#Y ; AR3 points to Y results
INTR 20 ; Invoke software interrupt #20
; .
; .
; .
*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
* This routine uses the block repeat functionality of the TMS320C50 to find
* the maximum value of 16 executions of the equation Y=aX^2+bX+c. The X values
* are pointed at by AR1. The Y results are pointed at
* by AR3. The coefficients are pointed at by AR2.
* At the completion of the routine, the ACC contains the maximum value.
* All other registers are unaffected.
*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ISR20 LDP #0 ; Use page 0 of data memory.
LACC #08000h
SACB ; Initialize AccB with min. possible value
MAR *,AR1 ; ARP <- AR1
*
* Load block repeat count register with 15.
*
SPLK #0Fh,BRCR
*
* Repeat Block.
*
RPTB END_LOOP-1 ; For i=0;i<=15;i++.
ZAP ; ACC = PREG = 0.
SQRA *+,AR2 ; TREG0 = X PREG = X^2
SPL TEMP ; Save X^2.
MPY *+ ; PREG = b*X
LTA TEMP ; TREG = X^2 ACC = b*X
MPY *+ ; PREG = a*X^2
APAC ; ACC = a*X^2 + b*X
ADD *,0,AR3 ; ACC = A*X^2 + b*X + c
SACL *+,0,AR1 ; Save Y.
CRGT ; Save maximum Y.
END_LOOP
SACL TEMP ; Save the result temporarily
LACC #RE_ENTER
PUSH ; Push re-entry address onto stack
RETI ; Pop all registers
RE_ENTER
LACC TEMP ; Load ACC with the max. value
RET ; Return to interrupted code